<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title> - 添加藏品</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="__PUBLIC__/admin/favicon.ico">
    <link href="__PUBLIC__/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/css/plugins/webuploader/webuploader.css">
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/css/demo/webuploader-demo.css">

    <link href="__PUBLIC__/admin/css/animate.css" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/style.css?v=4.1.0" rel="stylesheet">

    <style>
        .ay-header-action-bar {
            height: 30px;
            line-height: 30px;
            border-bottom: 1px solid rgb(224, 224, 224);
        }

        .ay-header-action-bar a {
            color: grey;
            line-height: 30px;
        }
        .img-div{
            border: 1px solid #ddd;
            border-radius: 100%;
            float: left;
            line-height: 1;
            margin-left: 5px;
            overflow: hidden;
        }
    </style>
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="ay-header-action-bar">
        <div class="pull-left">
            <a href="{:URL('collect/collection')}">
                <i class="fa fa-chevron-left"></i> 返回
            </a>
        </div>
        <div class="pull-right">
        </div>
    </div>

    <div class="wrap" style="text-align: left; margin-left: auto; margin-right: auto;">
        <form role="form" class="form-horizontal" action="{:URL('news/a')}" method="post" enctype="multipart/form-data" onsubmit="return checkform();">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title">藏品信息</h3>
                </div>
                <div class="panel-body">
                    <div class="row">
                        <div class="col-xs-12 col-md-12">
                            <div class="form-group">
                                <label class="col-xs-2 col-md-2 control-label">
                                    <!---->
                                    藏品名称
                                </label>
                                <div class="col-xs-3 col-md-3">
                                    <input  type="text" class="form-control" name="name" value="{$data['name']}">
                                    <a style="float:right;color:red;margin:-20px;">*</a>
                                </div>
                                <label class="col-xs-2 col-md-2 control-label">
                                    <!---->
                                    合同号
                                </label>
                                <div class="col-xs-3 col-md-3">
                                    <input type="text" class="form-control" name="num" value="{$data['num']}">
                                    <a style="float:right;color:red;margin:-20px;">*</a>
                                </div>

                            </div>

                            <div class="form-group">
                                <label class="col-xs-2 col-md-2 control-label">
                   装裱形式                  <!---->
                                    
                                </label>
                                <div class="col-xs-3 col-md-3">
                                    <input type="text" class="form-control" name="mount" value="{$data['mount']}">
                                    <a style="float:right;color:red;margin:-20px;">*</a>
                                </div>
                                <label class="col-xs-2 col-md-2 control-label">
                                    <!---->
                                    类别
                                </label>
                                <div class="col-xs-3 col-md-3">
                                    <input type="text" class="form-control" name="type" value="{$data['type']}">
                                    <a style="float:right;color:red;margin:-20px;">*</a>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-xs-2 col-md-2 control-label">
                                    <!---->
                                    作者
                                </label>
                                <div class="col-xs-3 col-md-3">
                                    <input type="text"  class="form-control" name="author" value="{$data['author']}">
                                    <a style="float:right;color:red;margin:-20px;">*</a>
                                </div>
                                <label class="col-xs-2 col-md-2 control-label">
                                    <!---->
                                    委托单位
                                </label>
                                <div class="col-xs-3 col-md-3">
                                    <input type="text" class="form-control" name="user"value="{$data['user']}">
                                    <a style="float:right;color:red;margin:-20px;">*</a>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-xs-2 col-md-2 control-label">
                                    <!---->
                                    首次入库时间
                                </label>
                                <div class="col-xs-3 col-md-3">
                                    <input name="time" value="{$data['time']}"class="form-control layer-date" placeholder="YYYY-MM-DD hh:mm:ss" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})">
                                    <a style="float:right;color:red;margin-top:10px;">*</a>
                                </div>

                            </div>
                            <div class="form-group">
                                <label class="col-xs-2 col-md-2 control-label">
                                    <!---->
                                    库区号
                                </label>
                                <div class="col-xs-3 col-md-3">
                                    <input type="text" class="form-control" name="cnum"value="{$data['cnum']}">
                                    <a style="float:right;color:red;margin:-20px;">*</a>
                                </div>
                                <label class="col-xs-2 col-md-2 control-label">
                                    <!---->
                                    完整程度
                                </label>
                                <div class="col-xs-3 col-md-3">
                                    <input type="text" class="form-control" name="integrity"value="{$data['integrity']}">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-xs-2 col-md-2 control-label">
                                    <!---->
                                    内径尺寸
                                </label>
                                <div class="col-xs-3 col-md-3">
                                    <input type="text" class="form-control" name="size"value="{$data['size']}">
                                </div>
                                <label class="col-xs-2 col-md-2 control-label">
                                    <!---->
                                    外径尺寸
                                </label>
                                <div class="col-xs-3 col-md-3">
                                    <input type="text" class="form-control" name="fsize"value="{$data['fsize']}">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-xs-2 col-md-2 control-label">
                                    <!---->
                                    年代
                                </label>
                                <div class="col-xs-3 col-md-3">
                                    <input type="text" class="form-control" name="years"value="{$data['years']}">
                                </div>
                                <label class="col-xs-2 col-md-2 control-label">
                                    <!---->
                                    征集人
                                </label>
                                <div class="col-xs-3 col-md-3">
                                    <input type="text" class="form-control" name="zman"value="{$data['zman']}">
                                </div>
                            </div>
                            <div class="form-group">


                                <label class="col-xs-2 col-md-2 control-label">
                                    <!---->
                                    图录号
                                </label>
                                <div class="col-xs-3 col-md-3">
                                    <input type="text" class="form-control" name="card"value="{$data['card']}">

                                </div>
                                <label class="col-xs-2 col-md-2 control-label">
                                    <!---->
                                    释文
                                </label>
                                <div class="col-xs-3 col-md-3">
                                    <input type="text" class="form-control" name="sintroduce"value="{$data['sintroduce']}">

                                </div>
                            </div>
                            <div class="form-group">


                                <label class="col-xs-2 col-md-2 control-label">
                                    <!---->
                                    临时入库时间
                                </label>
                                <div class="col-xs-3 col-md-3">
                                    <input value="{$data['lsrtime']}"name="lsrtime"class="form-control layer-date" placeholder="YYYY-MM-DD hh:mm:ss" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})">


                                </div>
                                <label class="col-xs-2 col-md-2 control-label">
                                    <!---->
                                    临时出库时间
                                </label>
                                <div class="col-xs-3 col-md-3">
                                    <input name="lsctime"value="{$data['lsctime']}"class="form-control layer-date" placeholder="YYYY-MM-DD hh:mm:ss" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})">

                                </div>
                            </div>
                            <div class="form-group">


                                <label class="col-xs-2 col-md-2 control-label">
                                    <!---->
                                    题跋
                                </label>
                                <div class="col-xs-3 col-md-3">
                                    <input type="text" class="form-control" name="ts"value="{$data['ts']}">

                                </div>
                                <label class="col-xs-2 col-md-2 control-label">
                                    <!---->
                                    款识
                                </label>
                                <div class="col-xs-3 col-md-3">
                                    <input type="text" class="form-control" name="ks"value="{$data['ks']}">

                                </div>
                            </div>
                            <div class="form-group">


                                <label class="col-xs-2 col-md-2 control-label">
                                    <!---->
                                    钤印
                                </label>
                                <div class="col-xs-3 col-md-3">
                                    <input type="text" class="form-control" name="yj"value="{$data['yj']}">

                                </div>
                                <label class="col-xs-2 col-md-2 control-label">
                                    <!---->
                                    备注
                                </label>
                                <div class="col-xs-3 col-md-3">
                                    <input type="text" class="form-control" name="remarks"value="{$data['remarks']}">

                                </div>
                            </div>
                            <div class="form-group">


                                <label class="col-xs-2 col-md-2 control-label">
                                    <!---->
                                    保管单价
                                </label>
                                <div class="col-xs-3 col-md-3">
                                    <input type="text" class="form-control" name="bgprice"value="{$data['bgprice']}">

                                </div>
                                <label class="col-xs-2 col-md-2 control-label">
                  材质             
                                </label>
                                <div class="col-xs-3 col-md-3">
                                    <input type="text" class="form-control" name="material"value="{$data['material']}">
                                </div>

                            </div>
                             <div class="form-group">


                                <label class="col-xs-2 col-md-2 control-label">
                                    <!---->
             委托人
                                </label>
                                <div class="col-xs-3 col-md-3">
                                    <input type="text" class="form-control" name="wtr"value="{$data['wtr']}">

                                </div>
                               

                            </div>
                          


                               

                          


                            <div class="form-group">
                                <label class="col-xs-2 col-md-2 control-label">
                                    <!---->
                                    藏品简介
                                </label>
                                <div class="col-xs-8 col-md-8">
                                    <textarea style="resize: none;" type="text" class="form-control" class="introduce" name="introduce">{$data.introduce}</textarea>
                                </div>
                            </div>


                            <div class="form-group">
                                <label class="col-xs-2 col-md-2 control-label">
                                    图片上传
                                </label>
                                <div class="col-xs-8 col-md-8">
                                    <form id="form"  enctype="multipart/form-data">
                                        <input type="file" id="xdaTanFileImg" value=""  multiple="multiple"  name="fileAttach[]" onchange="xmTanUploadImg(this)"/>
                                        {foreach name="data['image']" item='v'}
                                             <img src="__PUBLIC__/uploads/{$v}" data-original="__PUBLIC__/uploads/{$v}" style="cursor: zoom-in;height:80px;width:80px;">
                                        {/foreach}
                                        <div class="img-box" id="imgboxid">

                                        </div>
                                      <!--   <img src=""> -->
                                        <div id="xmTanDiv"></div><br/>
                                        <!--<div id="errordiv"   style="margin-top:15px;width:100%;text-align:center;">
                                            <input id="bt" type="button" onclick="test(this)" value="提交" />
                                        </div>-->
                                    </form>

                                </div>
                            </div>

                        </div>
                        <div class="form-actions text-center">
                            <input value="保存"type="submit" class="btn btn-primary btn-lg" style="width: 200px;">

                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>

<!-- 全局js -->
<script src="__PUBLIC__/admin/js/jquery.min.js?v=2.1.4"></script>
<script src="__PUBLIC__/admin/js/bootstrap.min.js?v=3.3.6"></script>

<!-- 自定义js -->
<script src="__PUBLIC__/admin/js/content.js?v=1.0.0"></script>
<!-- layerDate plugin javascript -->
<script src="__PUBLIC__/admin/js/plugins/layer/laydate/laydate.js"></script>
<script>
    //外部js调用
//    laydate({
//        elem: '#timebuying', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎，因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
//        event: 'focus' //响应事件。如果没有传入event，则按照默认的click
//    });
    laydate.render({
        elem: '#hou' //指定元素
    });
    //外部js调用
    laydate({
        elem: '#entrydate', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎，因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
        event: 'focus' //响应事件。如果没有传入event，则按照默认的click
    });
</script>
<!-- Web Uploader -->
<script type="text/javascript">
    // 添加全局站点信息
    var BASE_URL = 'js/plugins/webuploader';
</script>
<script src="__PUBLIC__/admin/js/plugins/webuploader/webuploader.min.js"></script>

<script src="__PUBLIC__/admin/js/demo/webuploader-demo.js"></script>

</body>

</html>
<script type="text/javascript">
    //选择图片，马上预览
    function xmTanUploadImg(obj) {

        var fl=obj.files.length;
        for(var i=0;i<fl;i++){
            var file=obj.files[i];
            var reader = new FileReader();

            //读取文件过程方法

            reader.onloadstart = function (e) {
                console.log("开始读取....");
            }
            reader.onprogress = function (e) {
                console.log("正在读取中....");
            }
            reader.onabort = function (e) {
                console.log("中断读取....");
            }
            reader.onerror = function (e) {
                console.log("读取异常....");
            }
            reader.onload = function (e) {
                console.log("成功读取....");

                var imgstr='<img style="width:100px;height:100px;" src="'+e.target.result+'"/>';
                var oimgbox=document.getElementById("imgboxid");
                var ndiv=document.createElement("div");

                ndiv.innerHTML=imgstr;
                ndiv.className="img-div";
                oimgbox.appendChild(ndiv);

            }

            reader.readAsDataURL(file);
//alert(1);
        }

    }
</script>
<script>
function checkform(){
	var name=$("input[name='name']").val();
	if($.trim(name)==''){
		alert('请填写藏品名称');
		return false;
	}
	var num=$("input[name='num']").val();
	if($.trim(num)==''){
		alert('请填写合同号');
		return false;
	}
	var mount=$("input[name='mount']").val();
	if($.trim(mount)==''){
		alert('请填写装裱形式');
		return false;
	}
	var type=$("input[name='type']").val();
	if($.trim(type)==''){
		alert('请填写类别');
		return false;
	}
	var author=$("input[name='author']").val();
	if($.trim(author)==''){
		alert('请填写作者');
		return false;
	}
	var user=$("input[name='user']").val();
	if($.trim(user)==''){
		alert('请填写委托单位');
		return false;
	}
	var time=$("input[name='time']").val();
	if($.trim(time)==''){
		alert('请选择首次入库时间');
		return false;
	}
	
	
	var cnum=$("input[name='cnum']").val();
	if($.trim(cnum)==''){
		alert('请填写库区号');
		return false;
	}
	
}



</script>
